﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using LightSmokeTemperatureCameraAdjust.Properties;

namespace LightSmokeTemperatureCameraAdjust
{
	internal class ElementTypeFilter : ISelectionFilter
	{
		internal ElementTypeFilter(List<BuiltInCategory> inputLst)
		{
			this.m_lstStrCategory.AddRange(inputLst);
		}

		public bool AllowElement(Element elem)
		{
			for (int i = 0; i < this.m_lstStrCategory.Count; i++)
			{
                if (elem is FamilyInstance && elem.Category.Id.IntegerValue == (int)this.m_lstStrCategory[i])
				{
					string familyName = (elem as FamilyInstance).Symbol.FamilyName;
					if (familyName.Contains(Resources.StrLight) || familyName.Contains(Resources.StrFireDetectors) || familyName.Contains(Resources.StrDomeCamera))
					{
						return true;
					}
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			throw new NotImplementedException();
		}

		private List<BuiltInCategory> m_lstStrCategory = new List<BuiltInCategory>();
	}
}
